/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pe.edu.pucp.Util.Reportclass;

import java.util.ArrayList;
import java.util.List;
import net.sf.jasperreports.engine.JRDataSource;
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JRField;

/**
 *
 * @author oscar
 */
public class RepKardexDataSource implements JRDataSource{
    
    private List<RepKardex> repKardex = new ArrayList<>();
    private int indiceActual = -1;

    @Override
    public boolean next() throws JRException {
        return ++indiceActual < repKardex.size();
    }

    @Override
    public Object getFieldValue(JRField jrf) throws JRException {
        Object valor = null;
        switch (jrf.getName()) {
            case "paqEntrantes":
                valor = repKardex.get(indiceActual).getPaqentrantes();
                break;
            case "paqSalientes":
                valor = repKardex.get(indiceActual).getPaqsalientes();
                break;
            case "fechaReg":
                valor = repKardex.get(indiceActual).getFechaReg();
                break;                
        }

        return valor;
    }
    
    public void addRepKardex(RepKardex repKardex)
    {
        this.repKardex.add(repKardex);
    }
    
}
